﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SHomeWorkshop.LunarMind.LMETools
{
    public class DemoResourceInfo
    {
        public string LinkTitle { get; set; }

        public string LinkType { get; set; }

        public string RelativePath { get; set; }

        public string AbsolutePath
        {
            get
            {
                try
                {
                    if (string.IsNullOrWhiteSpace(RelativePath)) return "";

                    var resPath = Globals.PathOfWorkspace.TrimEnd('\\') + "\\" + RelativePath.TrimStart('\\');

                    if (System.IO.File.Exists(resPath)) return resPath;

                    var di = new System.IO.DirectoryInfo(Globals.MainWindow.FullPathOfDiskFile).Parent;
                    var path = di.FullName + RelativePath;

                    return System.IO.File.Exists(path) ? path : "";
                }
                catch { return ""; }
            }
        }
    }
}
